<template>
  <div>
    <el-card shadow="never" class="margin-30">
      <div slot="header">
        <span>条件查询</span>
      </div>
      <!-- card body -->
    </el-card>

    <el-card shadow="never" class="margin-30">

      <el-table :data="returnList" border stripe>
        <el-table-column
          type="index"
          align="center"
          label="#"
          width="50"
        />
        <el-table-column
          prop="orderSn"
          align="center"
          label="订单编号"
        />
        <el-table-column
          prop="id"
          align="center"
          label="订单ID"
        />
        <el-table-column

          align="center"
          label="退单状态"
        >
          <template slot-scope="scope">
            <!-- 0->待处理；1->退货中；2->已完成；3->已拒绝 -->
            <el-tag v-if="scope.row.status==0" type="danger" size="mini" effect="dark">待处理</el-tag>
            <el-tag v-if="scope.row.status==1" type="info" size="mini" effect="dark">退货中</el-tag>
            <el-tag v-if="scope.row.status==2" type="success" size="mini" effect="dark">已完成</el-tag>
            <el-tag v-if="scope.row.status==3" type="warning" size="mini" effect="dark">已拒绝</el-tag>

          </template>
        </el-table-column>
        <el-table-column
          prop="productName"
          align="center"
          label="商品名称"
        />
        <el-table-column
          prop="createTime"
          align="center"
          label="添加时间"
        />
        <el-table-column

          align="center"
          label="操作"
        >
          <template slot-scope="scope">
            <el-button type="primary" size="mini" icon="el-icon-view" @click="goReturnOrderDetail(scope.row.id)">查看详情</el-button>

          </template>
        </el-table-column>
      </el-table>

    </el-card>

  </div>
</template>
<script>
import {
  findReturnApply as findReturnApplyApi
} from '@/api/order/returnOrder'
import mix from '@/mixins/index'
export default {
  name: 'ReturnOrder',
  mixins: [mix],
  data() {
    return {
      returnList: []
    }
  },
  computed: {
  },
  watch: {
  },
  created() {
    this.getReturnOrderList()
  },
  mounted() {
  },
  methods: {
    goReturnOrderDetail(id) {
      this.$router.push({ name: 'ReturnOrderDetail', params: { id }})
    },
    async getReturnOrderList() {
      const res = await findReturnApplyApi(this.paginationObj.start, this.paginationObj.limit)
      const { success, data, message } = res
      if (success) {
        this.returnList = data.rows
        this.paginationObj.total = data.total
      } else {
        this.$message.error(message)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
